<?php

include_once 'db/Crud.php';
class LetivoLegenda extends Crud {
    protected $table = "letivo_legenda";
    private $idLetivo;
    private $idLegenda;
    
    public function getIdLetivo() {
        return $this->idLetivo;
    }

    public function getIdLegenda() {
        return $this->idLegenda;
    }

    public function setIdLetivo($idLetivo) {
        $this->idLetivo = $idLetivo;
    }

    public function setIdLegenda($idLegenda) {
        $this->idLegenda = $idLegenda;
    }

    public function insert() {
        $sql = "INSERT INTO $this->table (lele_let_id, lele_leg_id) VALUES (:idLetivo, :idLegenda)";
        $stmt = Db::prepare($sql);
        $stmt->bindParam(':idLetivo', $this->idLetivo);
        $stmt->bindParam(':idLegenda', $this->idLegenda);
        return $stmt->execute();
        
        
    }

    public function update($id) {
        
    }
    
    public function limpartabelaletivolegenda() {
        $sql = "DELETE FROM $this->table";
        $stmt = Db::prepare($sql);
        return $stmt->execute();
        
    }
            
    public function deleteidletivo($id){
        $sql = "DELETE FROM $this->table WHERE lele_let_id = :id";
        $stmt = Db::prepare($sql);
        $stmt->bindParam(':id', $id, PDO::PARAM_INT);
        return $stmt->execute();
    }
    
    public function deleteidlegenda($id){
        $sql = "DELETE FROM $this->table WHERE lele_leg_id = :id";
        $stmt = Db::prepare($sql);
        $stmt->bindParam(':id', $id, PDO::PARAM_INT);
        return $stmt->execute();
    }

}
